<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=
    , initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        /* 
            箭头函数中的this
                - 箭头函数本身是没有this
                    - 箭头函数他的this是由他的外层作用域决定，和它的调用方式无关
        */

        function fn() {
            console.log(this);
        }
        let fn2 = () => {
            console.log(this);
        }
        // fn()
        // fn2()

        window.color = 'red'

        // function sayColor(){
        //     console.log(this.color);
        // }

        
        const obj={
            color:'blue',
            fn, // fn:fn
            fn2,
            sayHello(){
                console.log(this);
                let c = ()=>{
                    console.log('jt=>',this.color);
                }
                c()
            }
        }
        // obj.fn()
        // obj.fn2()
        obj.sayHello()
        // obj.sayColor = sayColor


    

        










        // let a = () => console.log(1);

        
        // a()
        // let b = e => {
        //     console.log(e);
        // }
        // b(2)

        // let c = (a, b, c) => {
        //     console.log(a,b,c);
        // }
        // c(3,4,5)
    </script>
</body>

</html>